<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include/taglibs.jsp"%>
<script type="text/javascript">
//오늘날짜
var nowDate = null;
//화면에 보이는 설정된 날짜
var setDate = null;

var rooms = null;
//핫 튜스 롤링
var rollCnt = 1;
var rollMaxcnt=0;
function hotRolling(){
	$("#hotNew > div").hide();
	if($.browser.msie){
		$("#hot"+rollCnt).slideDown();	
	}else{
		$("#hot"+rollCnt).show();	
	}
	
	if(rollCnt==(rollMaxcnt)){
		rollCnt=-1;
	}
	rollCnt++;
}

function getCookie_( name ){
   var nameOfCookie = name + "=";
   var x = 0;
   while ( x <= document.cookie.length ){
        var y = (x+nameOfCookie.length);
        if ( document.cookie.substring( x, y ) == nameOfCookie ) {
             if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
                  endOfCookie = document.cookie.length;
             return unescape( document.cookie.substring( y, endOfCookie ) );
        }
        x = document.cookie.indexOf( " ", x ) + 1;
        if ( x == 0 )
            break;
    }
return "";
}


//마우스 위치 확인
var globalMouseX=0;
var globalMouseY=0;


//로딩 이미지 설정
function setLodingImg(showYN){
	
	if("Y"==showYN){
		$("#lodingPop").hide();
		$("#calTable").show();
	}else{
		$("#calTable").hide();
		
		var popLeft = $(window).width()/2-($("#lodingPop").width()/2);
		var popTop = $(window).height()/2-($("#lodingPop").height()/2);
		
		$("#lodingPop").css("top",popTop+"px");
		$("#lodingPop").css("left",popLeft+"px");

		$("#lodingPop").show();
	}
}

$(document).ready(function(){
	if(""!="${msg}"){
		alert("${msg}");
	}
	
	//팝업이미지 있으면 띄우기
	if("Y"!=getCookie_("popnew")){
	<c:if test="${pensionInfo.event_img !=null && ''!=pensionInfo.event_img }">
		<c:if test="${eventW !=null && ''!=eventW }">
			<c:if test="${eventH !=null && ''!=eventH }">
			var popLeft = $(window).width()/2-($("#layerPopup").width()/2);
			var popTop = $(window).height()/2-($("#layerPopup").height()/2);
			
			$("#layerPopup").css("top",popTop+"px");
			$("#layerPopup").css("left",popLeft+"px");

			$("#layerPopup").show();
			
			</c:if>
		</c:if>
	</c:if>
	}
	
	//달력숨기기
// 	setLodingImg("N");
	
	//마우스 위치 확인
	$('html').mousemove(function(e){
		globalMouseX = e.pageX;
		globalMouseY = e.pageY;
// 		$("#month").html(globalMouseY);
	});

	<c:if test="${hotList !=null && fn:length(hotList)>0 }">
	rollMaxcnt = ${fn:length(hotList)}-1;
	</c:if>
	<c:if test="${hotList !=null && fn:length(hotList)>1 }">
	setInterval( "hotRolling();", 2000);
	</c:if>
// 	setInterval( "hotRolling();", 2000);

	setDate = new Date();
	nowDate  = new Date().toString("yyyyMMdd");
	
	//객실 정보 가져오기
	var option = {
			url: "./pere101Q.do",
			data : {"p_id":'${param.p_id}'},
			success : function(json){
				rooms = json;
				changeNewDate(0);
			}
	};
// 	$.getJson(option);
	
});


//테이블에 쓸 객실명 가져오기
var tableRooms="";
function getTableRooms(){
	if(tableRooms==""){
		tableRooms=setTableList();
		return tableRooms;
	}else{
		return tableRooms;
	}
}

//예약페이지로 이동
function goReserrvation(p_id,me,pr_no,pg_no){
	
	if($(me).html().indexOf("예약대기")>-1 || $(me).html().indexOf("예약완료")>-1){
		return false;
	}
	var r_date = $(me).parent().parent().parent().parent().parent().parent().parent().attr("id").replace("day_","");
	<c:if test="${'N'==pensionInfo.reservation_yn}">
	alert("예약은 전화로만 가능합니다");
	return false;
	</c:if>
	
// 	alert(pg_no);
// 	return false;
	location.href="./petc1002Q.do?p_id="+p_id+"&reservation_dt="+r_date+"&pg_no="+pg_no;
}

//달력에 표시할수 있도록 테이블로 만들어둠
function setTableList(){
	//아이콘 보여줄지 여부
	var p_ico_yn = rooms.list[0].p_ico_yn;
	var html="";
	if(rooms!=null){
		$.each(rooms.list, function (i) {
			if(p_ico_yn=='Y'){
				var room_type = this.room_type;
				var img_src = "res_icon_big.gif";
				if(room_type=="F"){
					img_src ="res_icon_family.gif";
				}else if(room_type=="C"){
					img_src ="res_icon_couple.gif";
				}
				
				html+="<span class='divDel'><br/> <img src='/usr/images/"+img_src+"' width='10' height='10' border=\"0\"> "+
				"<span class=\"ptrnomal\" style=\"cursor: hand\"  "+
				"onMouseOver=\"doTooltip(this);\" "+
				"onmousemove='moveTip(this);'"+
				"onMouseOut=\"hideTip()\"> "+
				"<a href=\"#\" id='a_"+this.pr_no+"_@@date' onclick=\"goReserrvation('"+this.p_id+"',this,'"+this.pr_no+"');\""+
				" room_nm='"+this.room_nm+"' room_form='"+this.room_form+"' room_type='"+this.room_type+"' rm_status='' date='@@date' "+
				"busy_1_base='"+this.busy_1_base+"' busy_1_fri='"+this.busy_1_fri+"' busy_1_sat='"+this.busy_1_sat+"'> "+
				this.room_nm+"</a></span></span>";
			}else{
				html+="<span class='divDel'><br/> "+
				"<span class=\"ptrnomal\" style=\"cursor: hand;padding-left:10px;\"  "+
				"onMouseOver=\"doTooltip(this);\" "+
				"onmousemove='moveTip(this);'"+
				"onMouseOut=\"hideTip()\"> "+
				"<a href=\"#\" id='a_"+this.pr_no+"_@@date' onclick=\"goReserrvation('"+this.p_id+"',this,'"+this.pr_no+"');\""+
				" room_nm='"+this.room_nm+"' room_form='"+this.room_form+"' room_type='"+this.room_type+"' rm_status='' date='@@date' "+
				"busy_1_base='"+this.busy_1_base+"' busy_1_fri='"+this.busy_1_fri+"' busy_1_sat='"+this.busy_1_sat+"'> "+
				this.room_nm+"</a></span></span>";
			}
			
		});
	}
	
	return html;
}

function goNextMonth(nextNum){
	
// 	${fn:substring(reservation_dt,0,4)}년 ${fn:substring(reservation_dt,4,6)}월
	var nDt = new Date();
	nDt.set({year:${fn:substring(reservation_dt,0,4)},month:(Number(${fn:substring(reservation_dt,4,6)})-1),day:Number(${fn:substring(reservation_dt,6,8)})});
	nDt.addMonths(nextNum);
// 	alert(nDt.toString("yyyyMMdd"));
	location.href="./petc1001Q.do?p_id=${param.p_id}&reservation_dt="+nDt.toString("yyyyMMdd");
}

//다음달 표시 옵션
var nextMonthYn=true;

//달력을 갱신한다
function changeNewDate(plusVal){
	//달력숨기기
	setLodingImg("N");
	
	//이전달력 검색 안되게 처리
	var setDateClone = setDate.clone();
	setDateClone.addMonths(plusVal);
	var chkNDt = Date.today();
	if(chkNDt-setDateClone>0){
		setLodingImg("Y");
		alert("오늘 이전자료는 선택할수 없습니다");	
		return false;	
	}
	setDate.addMonths(plusVal);
	$(".tt").remove();
	
	setYYYYMM();
	
	//다음달
	var nextMonth = setDate.clone().addMonths(1);

	var totalDays =setDate.getDaysInMonth();
	//다음달 표시 옵션이면
	if(nextMonthYn){
		totalDays +=nextMonth.getDaysInMonth();
	}
	
	var date1 = setDate.clone();
	date1.set({day:1});
		
	var dayName = date1.toString("ddd");
	var dateAdd = 0;


	//1일이 수요일이면 dateAdd = 3로 시작하기 위해 처리 0부터 시작
	for(var i=0; i < Date.CultureInfo.abbreviatedDayNames.length;i++){
		if(dayName == Date.CultureInfo.abbreviatedDayNames[i]){
			dateAdd=i;
			break;
		}
	}

	//다음달 숨김 처리
	var chkHideMonth = setDate.getDaysInMonth()+dateAdd;
	var weekCntNext = parseInt(chkHideMonth / 7);
	if((chkHideMonth % 7)>0){
		weekCntNext++;
	}
	//weekCnt1만 씀
	
	var totalDaysAdd= totalDays+dateAdd;
	var weekCnt = parseInt(totalDaysAdd / 7);
	if((totalDaysAdd % 7)>0){
		weekCnt++;
	}

	var html="";
	for(var i=0; i < weekCnt;i++){
		if(i>=weekCntNext){
			html+="<tr class=\"tt\" align=\"center\" style='display:none;'>";	
		}else{
			html+="<tr class=\"tt\" align=\"center\">";
		}
		
		for(var j=1; j<=7;j++){

			html+="<td class=\"day"+((i*7)+j)+"\" width=\"14%\" valign=\"top\" bgcolor=\"#fefefe\">&nbsp;&nbsp;&nbsp;</td>";
		}
		html+="</tr>";
	}
	$("#calTitle").after(html);
	
	var useMonth = null;
	//예약할수 있는데 최대 기간 2년
	if("${pensionInfo.reservation_use_month}"=="0"){
		useMonth = chkNDt.clone().addMonths(24);
	}else{
		useMonth = chkNDt.clone().addMonths(${pensionInfo.reservation_use_month});
	}
	
	for(var i = 1; i <= totalDays; i++ ){
		var day = date1.toString("d");
		if(i!=1 && day=="1"){
			day=date1.toString("M.d");
		}

		//데이터 체크해서 예약 못하도록 기간설정되어있으면 표시
		if(useMonth-date1<0){
			//예약못하는 기간
			var aId = $.replaceAll(getTableRooms(),"@@date",date1.toString("yyyyMMdd"));

			//가격설정 메세지
			var dayName_ = date1.toString("ddd");
			var dayMsg = "비수기 주중";
			if('Fri'==dayName_){
				dayMsg = "비수기 금요일";
			}
			if('Sat'==dayName_){
				dayMsg = "비수기 토요일";
			}
			<c:if test="${'N'==pensionInfo.pm_nm_yn}">
			dayMsg = "";
			</c:if>
// 			<tr>
// 			  <td align="left"  valign="top" height="100"><b><a href="/reservation/pentrip_reservation01.htm?sub=schedule&uid=sailing&step=list&y=2012&m=06&d=20"><font color="green">20</font></a></b><br>
// 			<br><span style="line-height:120%"><font color="#669900"><b>예약불가</b></font><br>2개월내에만<br>예약가능</span>							</td>
// 			</tr>
			var htm_tb="<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">"+
			"<tr>"+
			"<td align=\"left\" valign=\"top\" height=\"100\"><b><a"+
			"href=\"/reservation/pentrip_reservation01.htm?sub=schedule&uid=caribbean&step=list&y=2012&m=02&d=13\"><font "+
			"color=\"green\">"+day+"</font></a></b><br/><br/><span style='line-height:120%'><font color='#669900'><b>예약불가</b></font><br>${pensionInfo.reservation_use_month}개월내에만<br>예약가능</span>"+
			"<span class='pm_dc pms' style='color:red;text-align:center;width:100%'></span>"+
			"<div style='display:none;'>"+
			aId+
			"</div>"+
			"</td>"+
			"</tr>"+
			"</table>";
			
			var calVal = "day_"+date1.toString("yyyyMMdd");
			
			$(".day"+(i+dateAdd)).html(htm_tb);
			$(".day"+(i+dateAdd)).attr("id",calVal);

		}else{
// 			예약할수 있는 기간
			var aId = $.replaceAll(getTableRooms(),"@@date",date1.toString("yyyyMMdd"));

			//가격설정 메세지
			var dayName_ = date1.toString("ddd");
			var dayMsg = "비수기 주중";
			if('Fri'==dayName_){
				dayMsg = "비수기 금요일";
			}
			if('Sat'==dayName_){
				dayMsg = "비수기 토요일";
			}
			<c:if test="${'N'==pensionInfo.pm_nm_yn}">
			dayMsg = "";
			</c:if>
			
			var htm_tb="<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">"+
			"<tr>"+
			"<td align=\"left\" valign=\"top\" height=\"100\"><b><a"+
			"href=\"/reservation/pentrip_reservation01.htm?sub=schedule&uid=caribbean&step=list&y=2012&m=02&d=13\"><font "+
			"color=\"green\">"+day+"</font></a></b>&nbsp;&nbsp;<span class='pm_nm pms'>"+dayMsg+"</span>"+
			"<span class='pm_dc pms' style='color:red;text-align:center;position:relative;float:left;width:100%;clear:both;'>&nbsp;</span>"+
			aId+
			"</td>"+
			"</tr>"+
			"</table>";
			
			var calVal = "day_"+date1.toString("yyyyMMdd");
			
			
			
			$(".day"+(i+dateAdd)).html(htm_tb);
			$(".day"+(i+dateAdd)).attr("id",calVal);
		}
		date1.add(1).days();
	}

	var chkNowMonth = setDate.toString("yyyy")+setDate.toString("MM");
	var nowDateYYYYMM  = new Date().toString("yyyyMM");
	if(chkNowMonth==nowDateYYYYMM){
// 		오늘 이전 자료는 숨기기
		$(".tt").find("td").each(function (i){
			if($(this).attr("id")=="day_"+nowDate){
				return false;
			}
			
			$(this).find(".divDel").remove();
			$(this).find(".pms").remove();
		
		});	
	}else if(chkNowMonth>nowDateYYYYMM){//월이 오늘보다 크면 걍 두기
		
	}else{//이전이면 모두 어둡게 처리
		$("#calendar").find("td").each(function (i){
			$(this).addClass("bgGray");
		});		
	}
	
	if("N"=="${pensionInfo.reservation_cal}"){
		//지난주 삭제 다음달 추가
		if(nextMonthYn){
			var chkNum = 0;
			$(".tt").each(function (){
				if($(this).find(".divDel").length == 0){
					chkNum++;
					$(this).remove();
				}
			});
			for(var i=0; i <chkNum;i++){
				var chk1=true;
				$(".tt").each(function (){
		 			if($(this).css("display")=="none"){
		 				if(chk1){
		 					$(this).show();
								chk1=false;	
		 				}
		 			}
				});
			}

		}
	}
	
	//오늘 날짜 표시 
// 	$("#day_"+nowDate).attr("bgcolor","#e3fefe");
		//예약되어있는 룸 달력에 표시
	var option__ = {
		url: "./pere200_1Q.do",
		data : {"p_id":'${param.p_id}',"reservation_dt":setDate.toString("yyyyMMdd")},
		success : function(json){
			//룸 갯수
			var roomCnt = rooms.list.length;

			//달력에 색칠하기
			if(json!=null && json.list.length>0){
				$.each(json.list, function (i) {
					
					if($("#day_"+this.reservation_dt).find(".divDel").length>0){
						if(roomCnt==this.cnt){
							//예약 다 찬거
							$("#day_"+this.reservation_dt).attr("bgcolor","#FAFC98");
						}else{
							//예약방이 남아 있는자료
							$("#day_"+this.reservation_dt).attr("bgcolor","#FEF0FE");
						}						
					}
				});	
			}
			//오늘 날짜 표시 
			$("#day_"+nowDate).attr("bgcolor","#e3fefe");
			//선택된 날짜표시
			var chkIcon = "<div id=\"event\" style=\"position:absolute; z-index:0 display:block;width: 45px;\">"+
				"	<img src=\"/usr/images/res_icon_today.gif\" width=\"15\" height=\"15\" border=\"0\">"+
				"</div>";
			$("#day_${param.reservation_dt}").prepend(chkIcon);
		}
	};
	$.getJson(option__);
	//객실별 예약 날짜 표시
	var option__2 = {
		url: "./pere200_2Q.do",
		data : {"p_id":'${param.p_id}',"reservation_dt":setDate.toString("yyyyMMdd")},
		success : function(json){
			//달력에 색칠하기
			if(json!=null && json.list.length>0){
				$.each(json.list, function (i) {
					if(null!=this.rm_status  && ""!=this.rm_status){
						//예약 상태인경우
						if("R"==this.rm_status){
							$("#a_"+this.pr_no+"_"+this.reservation_dt).html("<span class='ptrstandby'>예약대기</span>");
						}else if("C"==this.rm_status){
							$("#a_"+this.pr_no+"_"+this.reservation_dt).html("<span class='ptrend'>예약완료</span>");
						}
						$("#a_"+this.pr_no+"_"+this.reservation_dt).attr("reservation_nm",this.reservation_nm);
						$("#a_"+this.pr_no+"_"+this.reservation_dt).attr("r_phone",this.r_phone1+"-"+this.r_phone2+"-"+this.r_phone3);
						$("#a_"+this.pr_no+"_"+this.reservation_dt).attr("rm_status",this.rm_status);
						
					}
					if(null!=this.pm_pay && ""!=this.pm_pay){
						//프로모션 할인 있는 경우
						$("#a_"+this.pr_no+"_"+this.reservation_dt).attr("pm_pay",this.pm_pay);
						$("#a_"+this.pr_no+"_"+this.reservation_dt).attr("busy_type",this.busy_type);
						
						
						<c:if test="${'Y'==pensionInfo.pm_dc_yn}">
						var brChk = "";
							<c:if test="${'Y'==pensionInfo.pm_nm_yn}">
							brChk = "<br/>";
							</c:if>
						
						if(undefined!=this.pm_dc_m && 0 < this.pm_dc_m){

// 							if(this.pm_dc_m>9000){
// 								var dcWon = this.pm_dc_m/10000;
// 								$("#day_"+this.reservation_dt).find(".pm_dc").html(brChk+"DC : "+dcWon+"만원할인");
// 							}else{
// 								var dcWon = this.pm_dc_m/1000;
// 								$("#day_"+this.reservation_dt).find(".pm_dc").html(brChk+"DC : "+dcWon+"천원할인");
// 							}
							$("#day_"+this.reservation_dt).find(".pm_dc").html(brChk+"("+"DC : "+this.pm_dc_m+"원할인)");
							$("#day_"+this.reservation_dt).find(".pm_dc").css("margin-top","-10px");
						}
						if(undefined!=this.pm_per && 0 < this.pm_per){
							$("#day_"+this.reservation_dt).find(".pm_dc").html(brChk+"("+"DC : "+this.pm_per+"% 할인)");
							$("#day_"+this.reservation_dt).find(".pm_dc").css("margin-top","-10px");
						}
						</c:if>
						<c:if test="${'Y'==pensionInfo.pm_nm_yn}">
						if(undefined!=this.busy_type && "" != this.busy_type){
							if("0101"==this.busy_type){
								$("#day_"+this.reservation_dt).find(".pm_nm").html("비수기 주중");
							}else if("0102"==this.busy_type){
								$("#day_"+this.reservation_dt).find(".pm_nm").html("비수기 금요일");
							}else if("0103"==this.busy_type){
								$("#day_"+this.reservation_dt).find(".pm_nm").html("비수기 토요일");
							}else if("0104"==this.busy_type){
								$("#day_"+this.reservation_dt).find(".pm_nm").html("준수기 주중");
							}else if("0105"==this.busy_type){
								$("#day_"+this.reservation_dt).find(".pm_nm").html("준수기 금요일");
							}else if("0106"==this.busy_type){
								$("#day_"+this.reservation_dt).find(".pm_nm").html("준수기 토요일");
							}else if("0107"==this.busy_type){
								$("#day_"+this.reservation_dt).find(".pm_nm").html("성수기 주중");
							}else if("0108"==this.busy_type){
								$("#day_"+this.reservation_dt).find(".pm_nm").html("성수기 금요일");
							}else if("0109"==this.busy_type){
								$("#day_"+this.reservation_dt).find(".pm_nm").html("성수기 토요일");
							}
						}						
						</c:if>

					}
				});	
			}
			setLodingImg("Y");
		}
	};
	$.getJson(option__2);
	
	//지난일 그레이 처리하기
	$(".tt").find("td").each(function (i){
		if($(this).find(".divDel").length == 0){
			if($(this).html()=="&nbsp;&nbsp;&nbsp;"){
				$(this).attr("bgcolor","#f8f6f7");	
			}else{
				$(this).attr("bgcolor","#fffef6");
			}
		}
	});	

// 	calTitle	타이틀
}
//메인 날짜 변경
function setYYYYMM(){
	$("#yyyyMM").html(setDate.toString("yyyy")+"년 "+setDate.toString("MM")+"월");
	$("#year").html(setDate.toString("yyyy"));
	$("#month").html(setDate.toString("MM"));
}


//툴팁 보여주기 팝업
function doTooltip(me) {
	if('N'!='${pensionInfo.tooltip_yn}'){
		
			
		var room_type = $(me).find("a").attr("room_type");
		var room_type_nm="커플룸";
		if(room_type=="F"){
			room_type_nm="가족룸";
		}else 	if(room_type=="B"){
			room_type_nm="단체룸";
		}
		var pay=0;
		var dayType_nm = "비수기주중";
		if($(me).find("a").attr("pm_pay")==undefined){
			var nowDate = $(me).find("a").attr("date");
			
			var nDt = new Date();
			nDt.set({year:Number(nowDate.substr(0,4)),month:Number(nowDate.substr(4,2))-1,day:Number(nowDate.substr(6,2))});
				
			var dayName = nDt.toString("ddd");
			var dateAdd = 0;
	
	
			//1일이 수요일이면 dateAdd = 3로 시작하기 위해 처리 0부터 시작
			for(var i=0; i < Date.CultureInfo.abbreviatedDayNames.length;i++){
				if(dayName == Date.CultureInfo.abbreviatedDayNames[i]){
					dateAdd=i;
					break;
				}
			}
	
			if(dateAdd==5){
				//금요일
				pay = Number($(me).find("a").attr("busy_1_fri"))*1000;
				dayType_nm="비수기 금요일";
			}else if(dateAdd==6){
				//토요일
				pay = Number($(me).find("a").attr("busy_1_sat"))*1000;
				dayType_nm="비수기 토요일";
			}else{
				//주중
				pay = Number($(me).find("a").attr("busy_1_base"))*1000;
			}
		}else{
			pay =Number($(me).find("a").attr("pm_pay"));
			var busy_type = $(me).find("a").attr("busy_type");

			if("0101"==busy_type){
				dayType_nm="비수기 주중";
			}else if("0102"==busy_type){
				dayType_nm="비수기 금요일";
			}else if("0103"==busy_type){
				dayType_nm="비수기 토요일";
			}else if("0104"==busy_type){
				dayType_nm="준수기 주중";
			}else if("0105"==busy_type){
				dayType_nm="준수기 금요일";
			}else if("0106"==busy_type){
				dayType_nm="준수기 토요일";
			}else if("0107"==busy_type){
				dayType_nm="성수기 주중";
			}else if("0108"==busy_type){
				dayType_nm="성수기 금요일";
			}else if("0109"==busy_type){
				dayType_nm="성수기 토요일";
			}
	// 		0101
	// 		dayType_nm="";
		}
		
		var tip="";
		if($(me).find("a").attr("reservation_nm")==undefined){
			//예약이 안되어 있을때
			pay = $.comma(pay)+"원";
			tip = '<table width=\"182\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"#fe89e2\">';
			tip += '    <tr>';
			tip += '      <td bgcolor=\"#FFFFFF\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">';
			tip += '          <tr>';
			tip += '            <td height=\"23\" align=\"center\" bgcolor=\"#fe89e2\" class=\"resinfot\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">';
			tip += '                <tr align=\"center\" class=\"ptrinforoom\">';
			tip += '                  <td width=\"40%\">'+$(me).find("a").attr("room_nm")+'</td>';
			tip += '                  <td width=\"60%\">['+dayType_nm+']</td>';
			tip += '                </tr>';
			tip += '              </table></td>';
			tip += '          </tr>';
			tip += '          <tr>';
			tip += '            <td style=\"padding: 5px 7px 5px 7px;\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">';
			tip += '                <tr>';
			tip += '                  <td>'+room_type_nm+' : '+$(me).find("a").attr("room_form")+'</td>';
			tip += '                </tr>';
			tip += '                <tr>';
			tip += '                  <td height=\"18\">이용요금 : '+pay+'</td>';
			tip += '                </tr>';
			tip += '                <tr>';
			tip += '                  <td>상 태 : 예약가능</td>';
		 	tip += '               </tr>';
			tip += '              </table></td>';
			tip += '          </tr>';
			tip += '        </table></td>';
			tip += '    </tr>';
			tip += '  </table>';
		}else{
			//예약이 되어있을때
			var rm_status = $(me).find("a").attr("rm_status");
			var rm_status_nm= "<span class='ptrend'>예약완료</span>";
			if('R'==rm_status){
				rm_status_nm="<span class='ptrstandby'>예약대기</span>";
			}
			var r_nm = $.replaceAll($(me).find("a").attr("reservation_nm"),'♡','<span class="ptrblind">♡</span>');
			var r_ph = $.replaceAll($(me).find("a").attr("r_phone"),'♡','<span class="ptrblind">♡</span>');
			tip = '<table width=\"182\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"#fe89e2\">';
			tip += '    <tr>';
			tip += '      <td bgcolor=\"#FFFFFF\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">';
			tip += '          <tr>';
			tip += '            <td height=\"23\" align=\"center\" bgcolor=\"#fe89e2\" class=\"resinfot\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">';
			tip += '                <tr align=\"center\" class=\"ptrinforoom\">';
			tip += '                  <td width=\"40%\">'+$(me).find("a").attr("room_nm")+'</td>';
			tip += '                  <td width=\"60%\">['+dayType_nm+']</td>';
			tip += '                </tr>';
			tip += '              </table></td>';
			tip += '          </tr>';
			tip += '          <tr>';
			tip += '            <td style=\"padding: 5px 7px 5px 7px;\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">';
			tip += '                <tr>';
			tip += '                  <td>예약자 : '+r_nm+'</td>';
			tip += '                </tr>';
			tip += '                <tr>';
			tip += '                  <td height=\"18\">연락처 : '+r_ph+'</td>';
			tip += '                </tr>';
			tip += '                <tr>';
			tip += '                  <td>상 태 : '+rm_status_nm+'</td>';
		 	tip += '               </tr>';
			tip += '              </table></td>';
			tip += '          </tr>';
			tip += '        </table></td>';
			tip += '    </tr>';
			tip += '  </table>';
		}
	
		$("#tipDiv").html(tip);
		$("#tipDiv").show();
		
		var chkWidth = tooltipLeftMargin+window.event.x;
		if((chkWidth+$("#tipDiv").width()) >$("html").width()){
			$("#tipDiv").css("left",(chkWidth - $("#tipDiv").width() -30) +"px");
		}else{
			$("#tipDiv").css("left",(chkWidth) +"px");
		}
		
		$("#tipDiv").css("top",(globalMouseY) +"px");
	}
}




var tooltipLeftMargin=20;
var tooltipTopMargin=0;
//툴팁 이동
function moveTip(me){
	var chkWidth = tooltipLeftMargin+window.event.x;
	if((chkWidth+$("#tipDiv").width()) >$("html").width()){
		$("#tipDiv").css("left",(chkWidth - $("#tipDiv").width() -30) +"px");
	}else{
		$("#tipDiv").css("left",(chkWidth) +"px");
	}
	$("#tipDiv").css("top",(globalMouseY) +"px");
}
//툴팁 숨기기
function hideTip(){
	$("#tipDiv").hide();
}

//팝업숨기기
function closeMe(){
	$("#layerPopup").hide();
}

//쿠키설정후 팝업숨기기
function cookieSet(dayNum)
{
	var oDate, expiresDate;
	oDate = new Date();
	oDate.setDate(oDate.getDate() + dayNum);        
	expiresDate = oDate.toGMTString();
	document.cookie = "popnew=Y; expires=" + expiresDate + "; path=/;";
	closeMe();
}

</script>


<table width="100%" border="0" cellspacing="0" cellpadding="10">
	<tr>
		<td>
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td width="60%"><table width="100%" border="0" cellspacing="0"
							cellpadding="0">
							<tr>
								<td width="55"><img src="/usr/images/res_char.gif"
									width="47" height="57"></td>
								<td>
										
											<table border="0" cellspacing="0" cellpadding="1">
												<tr>
													<td width="15" class="reds">▶</td>
													<td class="dgrayb">케리비안 캠핑은 애완동물을 동반하실수 없습니다.</td>
												</tr>
											</table>
										
											<table border="0" cellspacing="0" cellpadding="1">
												<tr>
													<td width="15" class="reds">▶</td>
													<td class="dgrayb">캠핑내 무분별한 고성방가를 삼가하여 주시기 바랍니다.</td>
												</tr>
											</table>
										
											<table border="0" cellspacing="0" cellpadding="1">
												<tr>
													<td width="15" class="reds">▶</td>
													<td class="dgrayb">예약시 반드시 인원을 확인 하여주시기 바랍니다.</td>
												</tr>
											</table>
										
									</td>
							</tr>
						</table></td>
					<td width="40%" align="right" style="padding-right: 30px;"></td>
				</tr>
				<tr>
					<td style="padding-bottom: 10px; padding-top: 10px;"><table
							width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="56"><img src="/usr/images/res_icon_hot.gif"
									width="56" height="16"></td>
								<td class="dgrayb" style="padding-top: 2px; padding-left: 10px;">
									<div id="hotNew">
<!-- 										<div id="hot0">케리비안캠핑 입실시간은 오후 3시부터입니다.</div> -->
									</div>
								</td>
							</tr>
						</table></td>
					<td align="right" style="padding-bottom: 10px; padding-top: 10px;"><table
							width="85%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="53"><A href="#" onclick="goNextMonth(-1);"><img
										src="/usr/images/res_lastm.gif" width="53" height="13"></A></td>
								<td align="center" class="oranb2" id="yyyyMM">${fn:substring(reservation_dt,0,4)}년
									${fn:substring(reservation_dt,4,6)}월</td>
								<td width="53" align="right"><A href="#"
									onclick="goNextMonth(1);"><img
										src="/usr/images/res_nextm.gif" width="53" height="13"></A></td>
							</tr>
						</table></td>
				</tr>
			</table>
			<div id='tipDiv' style='position: absolute; z-index: 100'></div> <!-- 달력 시작 -->

			<table width=100% border="0" cellspacing="0" cellpadding="5"
				id="calTable">
				<tr>
					<td bgcolor="#edecec"><table cellspacing=1 cellpadding=0
							width='100%'>
							<tr>
								<td height=55 colspan=7 bgcolor="#FFFFFF"><table border="0"
										cellspacing="0" cellpadding="0">
										<tr>
											<td width="20">&nbsp;</td>
											<td class="month" id="month">${fn:substring(reservation_dt,4,6)}</td>
											<td width="30" valign="top" class="year"
												style="padding-left: 5px; padding-top: 12px;" id="year">${fn:substring(reservation_dt,0,4)}</td>
										</tr>
									</table>
							</tr>
							<tr align="center" id="calTitle">
								<td width='14%' height='35' bgcolor=#FC636A><img
									src="/usr/images/res_w_sun.gif" width="36" height="15"></td>
								<td width='14%' bgcolor=#fdfdfd><img
									src="/usr/images/res_w_mon.gif" width="40" height="15"></td>
								<td width='14%' bgcolor=#fdfdfd><img
									src="/usr/images/res_w_tue.gif" width="34" height="14"></td>
								<td width='14%' bgcolor=#fdfdfd><img
									src="/usr/images/res_w_wed.gif" width="40" height="14"></td>
								<td width='14%' bgcolor=#fdfdfd><img
									src="/usr/images/res_w_thur.gif" width="35" height="14"></td>
								<td width='14%' bgcolor=#86AD29><img
									src="/usr/images/res_w_fri.gif" width="26" height="14"></td>
								<td width='14%' bgcolor=#4DA6FA><img
									src="/usr/images/res_w_sat.gif" width="34" height="15"></td>
							</tr>
							${txtCal }
						</table>
				</tr>
			</table> <!-- 	달력 종료 -->
		</td>
	</tr>
</table>

<div id="layerPopup"
	style="position: absolute; left: 50px; top: 50px; display: none; border: 0px; border-color: black; background-color: white;">
	<table border="1" style="border-style: solid;">
		<tr>
			<td>
				<div style="" align="center">
					<img src="" />
				</div>
				<div style="padding: 2px;">
					<span style="float: left"><a href="#" onclick="closeMe();">닫기</a></span>
					<span style="float: right"><a href="#"
						onclick="cookieSet(1);">하루동안 열지 않기</a></span>
				</div>
			</td>
		</tr>
	</table>
</div>

<div id="lodingPop"
	style="position: absolute; left: 50px; top: 50px; display: none; border: 0px; border-color: black; background-color: white;">
	<table border="0" style="border-style: none;">
		<tr>
			<td>
				<div style="" align="center">
					<img src="/usr/images/ajax_loding1_fbisk.gif" />
				</div>
			</td>
		</tr>
	</table>
</div>

<div id="lodingPop"
	style="position: absolute; left: 50px; top: 50px; display: none; border: 0px; border-color: black; background-color: white;">
	<table border="0" style="border-style: none;">
		<tr>
			<td>
				<div style="" align="center">
					<img src="/usr/images/ajax_loding1_fbisk.gif" />
				</div>
			</td>
		</tr>
	</table>
</div>

